package com.example.demo;

import org.jeasy.rules.annotation.Action;
import org.jeasy.rules.annotation.Condition;
import org.jeasy.rules.annotation.Fact;
import org.jeasy.rules.annotation.Rule;

@Rule(name = "weather rule one", description = "if it rains then take an umbrella", priority = 1)
public class WeatherRule {

    @Condition
    public boolean itRains(@Fact("rain") boolean rain) {
        return rain;
    }

    @Action
    public void takeAnUmbrella() {
        System.err.println("方式（一）：注解的形式, It rains, take an umbrella!");
    }

    public void print(String msg) {
        System.err.println(msg);
    }
}
